package com.example.wuqujingdianphone.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.wuqujingdianphone.fragment.BRBookFragment;
import com.example.wuqujingdianphone.fragment.BRListenBookFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yuanpk on 2018/4/10.
 */

public class BookRackPagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragmentList = new ArrayList<>();
    private List<String> titltes = new ArrayList<>();


    public BookRackPagerAdapter(FragmentManager fm) {
        super(fm);
        fragmentList.add(BRBookFragment.getBRBookFragment());
        //fragmentList.add(BRListenBookFragment.getBRListenBookFragment());

        initTitle();
    }

    private void initTitle() {
        titltes.add("图书");
        //titltes.add("听书");
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }


    @Override
    public CharSequence getPageTitle(int position) {
        return titltes.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }
}
